<?php
	/**
	 * Created by PhpStorm.
	 * User: 陈森
	 * Date: 2020/12/28
	 * Time: 21:51
	 */

	namespace app\admin\model\scheduling;


	use core\basic\Model;

	class SchelistModel extends Model
	{
		//查询所有的排单
		public function Schelist($field,$keyword)
		{


			$fields = array(
				's.*',
				'u.usermobile',
				'p.buy_days',
				'p.Settlement_profits',
				'p.Minimum_amount',
			);
			$join = array(
				'ay_member u',
				's.user_id=u.id',
				'LEFT'
			);
			$join2 = array(
				'ay_single_profit p',
				's.scheduling_id=p.id',
				'LEFT'
			);
			return parent::table('ay_schelist s')->field($fields)
				->join($join)
				->join($join2)
				->order('s.id desc')
				->like($field, $keyword)
				->page(1, 10)
				->select();


		}
		//查询所有的排单
		public function ScheInfo($where)
		{

			$fields = array(
				's.*',
				'u.usermobile',
				'p.buy_days',
				'p.Settlement_profits',
				'p.Minimum_amount',
			);
			$join = array(
				'ay_member u',
				's.user_id=u.id',
				'LEFT'
			);
			$join2 = array(
				'ay_single_profit p',
				's.scheduling_id=p.id',
				'LEFT'
			);
			return parent::table('ay_schelist s')->field($fields)
				->join($join)
				->join($join2)
				->order('s.id desc')
				->where($where)
				->select();


		}

	}